package keeperproperties;

import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Properties;

import org.apache.log4j.Logger;

public class KeeperProperties {

	private Properties property = new Properties();
	private static final String SORRY = "Sorry properties file not found";
	private static KeeperProperties keeper_properties;
	private Logger log = Logger.getLogger(KeeperProperties.class);
	private String garageProperty = "garageProperty" ;
	private String shiftProperty ="shiftProperty";
	private String deleteProperty = "deleteProperty" ;
	private String filePath = "url";
	private HashMap<String, String> propertiesMap= new HashMap<String,String>();

	private KeeperProperties() {
		try {
			property.load(new FileReader("test.properties"));
			
		} catch (IOException e) {
			log.error(SORRY);
		}

	}

	public static KeeperProperties getInstance() {
		if (keeper_properties == null) {
			keeper_properties = new KeeperProperties();
		}
		return keeper_properties;
	}
	
 public HashMap<String,String> getProperties(){
	   propertiesMap.put(garageProperty,  property.getProperty("garageManager"));
	   propertiesMap.put(shiftProperty, property.getProperty("shiftTimeOrder"));
	   propertiesMap.put(deleteProperty,property.getProperty("deleteOrder"));
	   propertiesMap.put(filePath, property.getProperty("url"));
	   return propertiesMap;		
	}

	
}
